package org.test.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.test.dao.AdminMapper;
import org.test.service.AdminService;
import org.test.vo.Admin;

@Service //注解
@Transactional(readOnly = true)
public class AdminServiceImpl implements AdminService {

    //注入DAO层
    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Admin getAdminByUnameAndPwt(String username, String password) {
        return adminMapper.queryAdminByUsernameAndPassword(username,password);
    }

    @Override
    public int addAdmin(String username, String password) {
        return adminMapper.insertAdmin(username,password);
    }

    @Override
    public Admin getAdminByUname(String username) {
        return adminMapper.queryAdminByUsername(username);
    }

    @Override
    public int updateUser(int id, String username, String password) {
        return adminMapper.updateUser(id,username,password);
    }
}
